﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace CS4730_XNA_Graphics_Tutorial
{
    public class ModelRenderable : Renderable
    {
        private Model model;
        private Texture2D texture;
        public Matrix transform;

        public ModelRenderable(Model model, Texture2D texture, GraphicsDevice device)
        {
            this.model = model;
            this.texture = texture;
            transform = Matrix.Identity;
        }

        public void render(GameTime gt, Effect effect)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    part.Effect = effect;
                }
                mesh.Draw();
            }
        }

        public Matrix getTransform() {
            return transform;
        }

        public Texture2D getTexture() {
            return texture;
        }
    }
}
